package com.hxtec.polaris.controller;

import com.hxtec.polaris.commons.api.vo.Result;
import com.hxtec.polaris.commons.dto.PmsSearchParam;
import com.hxtec.polaris.service.SearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("elk")
@Api(value = "/elk", tags = "elk")
public class ElkController {

    @Resource
    private SearchService searchService;

    @GetMapping("executeSpuElkScyn")
    @ApiOperation(value = "同步商品")
    private Result<?> executeSpuElkScyn(){
        return Result.ok(searchService.executeSpuElkScyn());
    }


    @GetMapping("resetSpu")
    @ApiOperation(value = "重置elk")
    private Result<?> resetSpu(){
        return Result.ok(searchService.resetSpu());
    }


    @GetMapping("list")
    @ApiOperation(value = "从elk获取spu列表")
    private Result<?> spuList(PmsSearchParam searchParam){
        return Result.ok(searchService.searchInfo(searchParam));
    }

}
